const { DataTypes } = require("sequelize");

const seq = require("../db/seq");

const User = seq.define("newsP_user", {
  user_name: {
    type: DataTypes.STRING,
    unique: true,
    allowNull: false,
    comment: "用户名，唯一",
  },
  password: {
    type: DataTypes.CHAR(64),
    allowNull: false,
    comment: "密码",
  },
  gender: {
    type: DataTypes.BOOLEAN,
    allowNull: false,
    comment: "性别",
  },
  introduction: {
    type: DataTypes.STRING,
    allowNull: true,
    comment: "人的简介",
  },
  avatar: {
    type: DataTypes.STRING,
    allowNull: true,
    comment: "头像",
  },
  is_admin: {
    type: DataTypes.BOOLEAN,
    allowNull: false,
    defaultValue: 0,
    comment: "是否为管理员 0:编辑（默认）,1:是管理员",
  },
});

// User.sync({ force: true });

module.exports = User;
